package com.system.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.system.mapper.ComplainMapper;
import com.system.pojo.PageBean;
import com.system.pojo.complaininfo;
import com.system.service.ComplainService;
import com.system.utils.ThreadLocalUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ComplainServiceImpl implements ComplainService {
    @Autowired
    private ComplainMapper complainMapper;

    @Override
    public PageBean<complaininfo> list(Integer pageNum, Integer pageSize, Integer ownerId) {
        PageBean<complaininfo> pb = new PageBean<>();
        PageHelper.startPage(pageNum, pageSize);
        List<complaininfo> as = complainMapper.list(ownerId);
        Page<complaininfo> p = (Page<complaininfo>) as;
        pb.setTotal(p.getTotal());
        pb.setItems(p.getResult());
        return pb;
    }

}